import defaultSettings from '@/settings'
import { useSettingsStore } from '@/store'

/**
 * 动态修改标题
 */
export const useDynamicTitle = (newTitle) => {
  const settingsStore = useSettingsStore()
  if (settingsStore.getDynamicTitle) {
    document.title = newTitle ? `${newTitle} - ${settingsStore.getTitle}` : settingsStore.getTitle
  } else {
    document.title = defaultSettings.title
  }
}
